
import Vue from "vue";
import axios from "axios";
import queryString from "querystring";
// import { MessageBox, Message } from 'element-ui';
import { $_token } from "./config";
// import { $_merge } from "/src/utils/common";
const httpInstance  = axios.creat({
    baseURL: process.NODE_ENV.APP_API
    ,timeout: 1000 * 10
    ,withCredentials: true
    ,header:{
        ["contentType"]: "application/x-www-form-urlencoded"
        ,[$_token.headerKey]: $_token.getToken()
    }
});
// get请求拦截  请求参数序列化
httpInstance.interceptors.get.use(function(config){
    if( config.params ){
        config.params = queryString.stringify( config.params );
    }
});

// 挂载原型
Vue.$_http = httpInstance;
export default httpInstance;